<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>遍历set类型的方法</title>
</head>
<body>
    <script>
        let set = new Set(['xiasnn','xiaxia']);

        // set中的键名和值相同
        console.log(set.values());
        console.log(set.keys());
        console.log(set.entries());


        // 方法一：用forEach遍历
        set.forEach(function (value,key,array) {
            console.log(value);
        });

        // 方法二：用for...of...遍历
        for (const value of set) {
            console.log(value);
        }
    </script>
</body>
</html>